package cn.flyme.shop.service.impl;

import cn.flyme.shop.entities.Goods;
import cn.flyme.shop.entities.GoodsExample;
import cn.flyme.shop.mapper.GoodsMapper;
import cn.flyme.shop.service.ShopService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ShopServiceImpl implements ShopService {

    @Autowired
    GoodsMapper mapper;

    @Override
    public Goods getGoodById(Integer id) {
        return null;
    }

    @Override
    public PageInfo getCataGoods2(Integer id, Integer page, Integer size) {
        if(page==null || size==null){
            page = 1;
            size = 8;
        }
        PageHelper.startPage(page,size);
        List<Goods> goods = mapper.selectByExample(new GoodsExample());
        return new PageInfo(goods);
    }
}
